<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<script type="text/javascript">
    window.onload = function() {
        var ps = document.getElementById("one");
        ps.innerText = "<span>hi</span>";
    }
</script>

<p id="one" style="background:silver; width:300px;">
    this is
    <i style="width:100px; background-color:gold;">another</i>
    text
</p>
</body>
</html>